package com.devops.shiro.vm;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

@ApiModel(value="更新用户Vo", description="")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BaseUserUpdateVM {

    @NotBlank(message = "用户id不能为空")
    @ApiModelProperty(value = "用户ID")
    private String id;

    @Length(max=20)
    @NotBlank
    @ApiModelProperty(value = "用户真实名字")
    private String realName;

    @Length(max=20)
    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    @ApiModelProperty(value = "用户性别")
    private Boolean sex;

    @Pattern(regexp = "^[a-zA-Z]\\w{5,17}$",message = "密码以字母开头，长度在6~18之间，只能包含字符、数字和下划线")
    @ApiModelProperty(value = "用户密码")
    private String password;

    @Length(max=50)
    private String imageId;

    @Pattern(regexp = "^[150[0-9]+]{11}",message = "电话格式不正确")
    @ApiModelProperty(value = "用户电话号码")
    private String phoneNumber;

    @Length(max=20)
    private String signature;

    @Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$",message = "邮箱格式不正确")
    private String email;

    @NotNull
    private List<Integer> roleIds;

}
